<#include "head.html"/>
<SCRIPT type="text/javascript">
	$(document).ready(function(){
		var ztree = $.fn.zTree.init($(document.getElementById("zTree_adminLIst")), setting, zNodes1);
		ztree.selectNode(ztree.getNodeByParam("id", "taskpassing", null));
		var data = [${excutingcount!'0'}, ${waitingcount!'0'}, ${stopcount!'0'}];
		var category = [
                    '正在执行',
                    '等待中',
                    '已挂起'
                ];
		createBarChart("#container" , "bar" , data , category , "合计（${allcount!'0'}）");		
		var pieData = [
                ['正在执行', ${excutingcount!'0'}],
                ['等待中',  ${waitingcount!'0'}],
                ['已挂起',  ${stopcount!'0'}]
            ]
		createPieChart("#piecontainer" ,  pieData );
	});
	function taskManage(id){
		art.confirm('您确定要取消本次任务吗？' 
		, function(){
			var url = "/${orgi}/manage/task/"+id+"/taskcancel.html";
			$("#searchForm").append("<input type='hidden' name='stoptype' value='laterallrequest'/>");
			$("#searchForm").attr("action",url);
	    	submitSearchForm("current");
			
		} 
		, function(){})
	}
</SCRIPT>
<div class="rs_layout_top breadCrumbWrap">
	<div class="breadCrumbStart">您当前的位置是在：</div>
	<ul class="breadCrumb">
		<li class="bc_ithems"><a href="/${orgi}/manage/task/taskpassing.html">系统管理</a></li>
		<li class="bc_ithems"><a href="/${orgi}/manage/task/taskpassing.html">状态</a></li>
	</ul>
	
</div>
<div class="rs_layout_left" resizable="true" style="width:230px;">
	<div class="lftTreeWrap">
		<div class="task_title2">状态</div>
		<div class="ztree" id="zTree_adminLIst"></div>
		<div class="rs_layout_top" style="font-size: 12px" id="filterDiv">
		<form id="searchForm" action="/${orgi}/manage/task/taskpassing.html" method="post">	
			<input type="hidden" id="beginNum" name="beginNum" value="">
			<input type="hidden" id="endNum" name="endNum" value="">
			<input type="hidden" id="action" name="action" value="current">
			<div class="task_title2">过滤器</div>

			<div style="padding-bottom: 10px;padding-left: 20px;border-bottom: solid 2px #ddd;">
				<label style="width: 100%;"><input <#if plantask??&&plantask=='true'>checked="checked"</#if> type="radio" name="plantask" value="true">后台活动 </label><br>
				<label><input type="radio" <#if plantask??&&plantask=='false'>checked="checked"</#if> name="plantask" value="false">交互式活动 </label>
			</div>

			
			<div style="padding-left: 20px;padding-top: 5px;">
					<input type="radio" onclick="timeEnable()" <#if timeType??><#if timeType??&&timeType=='1'>checked="checked"</#if><#else>checked="checked"</#if> name="timeType" value="1"> 
					<select <#if timeType??&&timeType=='2'>disabled="disabled"</#if> id="times" name="times">
						<option <#if times??&&times=='4'>selected="selected"</#if> value="4">过去4小时</option>
						<option <#if times??&&times=='8'>selected="selected"</#if> value="8">过去8小时</option>
						<option <#if times??&&times=='12'>selected="selected"</#if> value="12">过去12小时</option>
						<option <#if times??&&times=='24'>selected="selected"</#if> value="24">过去24小时</option>
						<option <#if times??&&times=='168'>selected="selected"</#if> value="168">过去7天</option>
						<option <#if times??&&times=='720'>selected="selected"</#if> value="720">过去30天</option>
						<option <#if times??&&times=='8760'>selected="selected"</#if> value="8760">过去365天</option>
					</select>
					
					<div style="margin-top: 10px;">
					<label><input type="radio" onclick="timeEnable()" <#if timeType??&&timeType=='2'>checked="checked"</#if> style="float: left;" name="timeType" value="2">&nbsp;&nbsp;开始时间：</label>
						<div style="margin-left: 30px">
							<input class="Wdate" type="text" onfocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime\')}'})" <#if timeType??&&timeType=='1'>disabled="disabled"</#if>  id="beginTime" name="beginTime" style="margin-top: 5px;width:145px;" value="${beginTime!''}">
							<br>
							结束时间：<br><input class="Wdate" type="text" onfocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'beginTime\')}'})" <#if timeType??&&timeType=='1'>disabled="disabled"</#if>  id="endTime" name="endTime" style="margin-top: 5px;width:145px;" value="${endTime!''}">
						</div>
					
					</div>
					
					
					<div style="margin-top: 10px;">
					用户：<span id="usernametext">${username!'任意'}<#if username??&&username==''>任意</#if></span>
						<div style="margin-left: 30px;">
							
							<input type="hidden" name="userid" id="userid" value="${userid!''}">
							<input type="hidden" name="username" id="username" value="${username!''}">
							<br>
							<i style="color: #0000CC;" data-toggle="ajax" id="newreport" href="/${orgi}/manage/role/userselect.html" data-width="565" title="选择用户">选择用户...</i>
						</div>
					
					</div>
					
					<div style="margin-top: 10px;">
					报表：<span id="reportnametext">${reportname!'任意'}<#if reportname??&&reportname==''>任意</#if></span><br><br>
					目录：<span id="dicnametext">${dicname!'任意'}<#if dicname??&&dicname==''>任意</#if></span>
						<div style="margin-left: 30px;">
							
							<input type="hidden" name="reportid" id="reportid" value="${reportid!''}">
							<input type="hidden" name="reportname" id="reportname" value="${reportname!''}">
							<input type="hidden" name="dicid" id="dicid" value="${dicid!''}">
							<input type="hidden" name="dicname" id="dicname" value="${dicname!''}">
							<br>
							<i style="color: #0000CC;" data-toggle="ajax" id="newreport" href="/${orgi}/user/report/pub/reportselect.html" data-width="565" title="选择报表">选择报表...</i>
						</div>
					
					</div>
					
				
					<div style="margin-top: 10px;">
						<label>状态：</label>
						<select name="status">
							<option  value="">任意</option>
							<option <#if status??&&status=='1'>selected="selected"</#if> value="1">正在执行</option>
							<option <#if status??&&status=='2'>selected="selected"</#if> value="2">等待中</option>
							<option <#if status??&&status=='3'>selected="selected"</#if> value="3">已挂起</option>
							
						</select>
					</div>
					
					<div style="margin-top: 10px;">
						<label>优先级：</label>
						<select name="priority">
							<option  value="">任意</option>
							<option <#if priority??&&priority=='1'>selected="selected"</#if>  value="1">1</option>
							<option <#if priority??&&priority=='2'>selected="selected"</#if>  value="2">2</option>
							<option <#if priority??&&priority=='3'>selected="selected"</#if> value="3">3</option>
							<option <#if priority??&&priority=='4'>selected="selected"</#if> value="4">4</option>
							<option <#if priority??&&priority=='5'>selected="selected"</#if> value="5">5</option>
						</select>
					</div>

			</div>
			<div style="text-align: center;margin-top: 10px;background: #ddd;padding: 5px 0px;">
				<input class="subButtonStyle" style="margin:0px auto;" onclick="submitSearchForm('current')" type="button" value="应用">
			</div>
			</form>
		</div>
	</div>
</div>
<!--<div class="rs_layout_right" style="width:300px;"></div>-->
<div class="rs_layout_center">
	<div class="rs_layout">
		<div class="rs_layout_top" style="height:180px; overflow:hidden; border-bottom: solid 1px #d7d7d7;">
			<div class="rs_layout">
				<div class="rs_layout_center">
					<div class="rs_layout">
						<div class="rs_layout_top" >
							<div class="task_title2">当前活动</div>
							<div class="row-fluid">
								<div class="span7"><div id="container" style="width: 90%; height: 140px;"></div></div>
								<div class="span4"><div id="piecontainer" style="width: 100%; height: 160px;margin:0 0 0 auto;"></div></div>
							</div>
							
						</div>
						
					</div>
				</div>
			</div>
		</div>
		<div class="rs_layout_center">
			
			<div class="tableScrollWrap">
					
				<table class="table_style_1">
					<thead>
						<tr>
							<th style="width:20px;">&nbsp;</th>
							<th><i class="verMidWrap">名称（目录）</i><i class="tbArrow"></i></th>
							<th><i class="minSize">执行时间</i><i class="tbArrow"></i></th>
							<th><i class="minSize">状态</i><i class="tbArrow"></i></th>
							<th><i class="minSize">执行人</i><i class="tbArrow"></i></th>
							<th><i class="minSize">优先级</i><i class="tbArrow"></i></th>
							<th class="minSize">操作</th>
						</tr>
					</thead>
					<tbody>
						
						<#if historytasks??>
						<#list historytasks as task>
						<tr>
							<td>&nbsp;</td>
							<td><a href="/${orgi}/manage/task/${task.id!''}/taskruninglist.html" data-toggle="ajax" data-width="750" title="${task.name!'任务'}"><i class="icons_tablelist_task"></i>${task.name!''}</a> <#if task.fetcher == false><font color='red'> --> 任务正在停止......</font></#if></td>
							<td class="minSize"><#if task.taskfiretime??>${task.taskfiretime?string("yyyy年MM月dd HH:mm:ss")}<#else>${task.nextfiretime?string("yyyy年MM月dd HH:mm:ss")}</#if></td>
							<td class="minSize"><#if task.taskstatus == "2">执行中<#else>等待执行</#if></td>
							<td class="minSize">${task.username!''}（${task.nickname!''}）</td>
							<td id="priority_td_${task.id}" style="width: 80px;" class="minSize">${task.priority!''}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
							<td class="minSize">
								<#if task.pause == true>
									<a onclick="art.confirm('您确定要继续该任务吗？' , function(){location.href='/${orgi}/manage/task/${task.id!''}/taskrestart.html'} , function(){})" href="javascript:void(0)"><i class="tbControlIcon tci-15" title="继续"></i></a>
								<#else>
									<a onclick="art.confirm('您确定要挂起该任务吗？' , function(){location.href='/${orgi}/manage/task/${task.id!''}/taskstop.html'} , function(){})" href="javascript:void(0)"><i class="tbControlIcon tci-9" title="挂起"></i></a>
								</#if>
								<a href="javascript:void(0)" onclick="taskManage('${task.id!''}')" title="取消任务"><i class="tbControlIcon tci-10"></i></a>
							</td>
						</tr> 
						</#list>
						</#if>
					</tbody>
				</table>
			</div>

		</div>
		<div class="rs_layout_bottom">
			<#include "../../public/pagination.html"/>
		</div>

	</div>
</div>
